/*
 * AddBundleScreen.fx
 *
 * Created on Nov 20, 2009, 7:34:57 PM
 */

package org.osgifx.ui;
import javafx.scene.CustomNode;
import java.lang.UnsupportedOperationException;
import javafx.scene.Node;
import javafx.scene.Group;
import javafx.scene.control.Button;
import javafx.scene.control.TextBox;
import org.osgifx.BundleInstaller;
import org.osgi.framework.BundleContext;
import org.osgifx.Main;

/**
 * @author johan
 */

public class AddBundleScreen extends CustomNode {

  public-init var bc: BundleContext;

var urlText: TextBox = TextBox {
    text: "file:/tmp/viewbundle.jar"
    width: 282
    selectOnFocus: true
  }

  var installButton: Button = Button {
    translateX: 300;
      text: "install"
      action: function() {
        println ("[JVDBG] install {urlText.text}");
        var installer: BundleInstaller = BundleInstaller {
          bc:bc;
          location:urlText.text;
        }
        installer.start();
        Main.showBundleOverviewScreen();
      }
    }

  var installGroup: Group = Group {
    translateY:10;
    content: [urlText, installButton];
  }

    override protected function create () : Node {
       installGroup;
    }


}
